﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication15
{
  class Program
  {
    static void Main(string[] args)
    {
      #region Object Initializer
      var testObject = TestObject.Create() : {S = "test"};
      Console.WriteLine(testObject.S);
      Console.WriteLine("");

      testObject = 
        TestObject.Create() : {S
        = "test" };
      Console.WriteLine(testObject.S);
      Console.WriteLine("");

      for (int i = 0 ; i < 10 ; i++)
      {
        testObject = 
          TestObject.Create() : {S
          = "test " + i.ToString() };
        Console.WriteLine(testObject.S);
      }
      Console.WriteLine("");

      for (int i = 0 ; i < 10 ; i++){testObject = 
          TestObject.Create() : {S
          = "test " + i.ToString() };
        Console.WriteLine(testObject.S);
      }
      Console.WriteLine("");

      for (int i = 0 ; i < 10 ; i++)
        testObject = 
          TestObject.Create() : {S
          = "test " + i.ToString() };
      Console.WriteLine(testObject.S);
      Console.WriteLine("");

      testObject = TestObject.Create() : {S = "test"}; Console.WriteLine(testObject.S); Console.WriteLine("");

      testObject = 
        TestObject.Create() : 
      {
        S
        = "test" };
      Console.WriteLine(testObject.S);
      Console.WriteLine("");

      Console.WriteLine(TestObject.Create() : {S  = "test" }.S);
      Console.WriteLine("");

      Console.
        WriteLine(TestObject.Create() : {S  = "test" }.S);
      Console.WriteLine("");

      Console.
        WriteLine(testObject : {S  = "test" }.S);
      Console.WriteLine("");

      var test = TestObject.Create() : { S1 = "S1", S2 = "S2", S3 = "S3" };
test : { S1 = "S1Bis", S2 = "S2Bis" };
for (int i = 0 ; i < 10 ; i ++)
  Console.WriteLine(TestObject.Create() : { S1 = i.ToString() }.S1);

      var test2 = TestObject.Create() : { S1 = "S1", S2 = "S2", S3 = "S3" };
test : { S1 = "S1Bis", 
  S2 = "S2Bis" };
for (int i = 0 ; i < 10 ; i ++)
  Console.WriteLine(TestObject.Create() : { S1 = i.ToString() }.S1);

      var testObjectList = new List<TestObject>{TestObject.Create() : {S = "test"}};
      foreach (var testObj in testObjectList)
        Console.WriteLine(testObj.S);
      Console.ReadLine();

      #endregion Object Initializer

      //#region Collection Initializer
      //int[] tab = {1, 2, 3};
      //tab += {4, 5, 6};

      //var strings = new List<string> { "a", "b", "c" };
      //strings = strings + { "d", "e" };
      //foreach (string s in strings)
      //   Console.WriteLine(s);
      //Console.WriteLine("");

      //List<String> strings2 = { "a", "b", "c" };
      //foreach (string s in strings2)
      //   Console.WriteLine(s);
      //Console.WriteLine("");

      //var testCollection = new TestCollection{ Strings : {"a", "b"}};
      //foreach (string s in testCollection.Strings)
      //   Console.WriteLine(s);
      //#endregion Collection Initializer
      Console.ReadLine();
    }
  }
}
